package io;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

public class DataOutputStreamDemo {

	public static void main(String[] args) throws Exception {
		DataOutputStream dataOutputStream = new DataOutputStream(new FileOutputStream("dataDemo.pfzhang"));
		dataOutputStream.writeInt(123);
		dataOutputStream.writeBoolean(false);
		dataOutputStream.writeUTF("哈哈");
		
		DataInputStream dataInputStream = new DataInputStream(new FileInputStream("dataDemo.pfzhang"));
//不按顺序读，数据数据看起来就乱的
		System.out.println(dataInputStream.readInt());
		System.out.println(dataInputStream.readBoolean());
		System.out.println(	dataInputStream.readUTF());
	
	}

}
